<?php
/**
 * Created by PhpStorm.
 * User: h
 * Date: 2021/4/14
 * Time: 11:40
 */

namespace app\index\controller;

use app\admin\model\Banner;
use app\admin\model\Navigation;
use app\admin\model\BaseSite;
use app\common\controller\Frontend;

class Base extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function __construct()
    {
        parent::__construct();
        $website = BaseSite::find(1);
        $header = Navigation::where(['status' => 1, 'pid' => 0, 'location' => 1])->order('sort asc')->limit(0, 8)->select();
        $nav_id = input('nav_id', 1);
        $nav = Navigation::find($nav_id);
        $footer = Navigation::where(['status' => 1, 'location' => 2])->select();;
        $footer = getTree($footer);
        $banner = Banner::select();
        $this->assign([
            'base' => $website,
            'header' => $header,
            'nav' => $nav_id,
            'nav_name' => $nav,
            'footer' => $footer,
            'banner' => $banner
        ]);
    }
}